package com.zhangyj.action;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.impl.StdSchedulerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ActionBaseServlet extends HttpServlet {
	private static Logger logger = LoggerFactory.getLogger(ActionBaseServlet.class);
	private static final long serialVersionUID = 3866055503767950L;
	BoastContext context = null;

	public void init() throws ServletException {
		super.init();
		logger.info("加载系统信息");
		context = BoastContext.load(this.getServletContext().getRealPath("WEB-INF/config"), this.getServletContext());
		try {
			Scheduler sched = StdSchedulerFactory.getDefaultScheduler();
			sched.start();
		} catch (SchedulerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		super.destroy();
		try {
			Scheduler sched = StdSchedulerFactory.getDefaultScheduler();
			sched.shutdown();
		} catch (SchedulerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
